package com.xyj.week02;

import com.xyj.week01.Node;

/**
 * 删除链表中中重复的元素
 */
public class T5 {



    public Node deleteDuplicates(Node head) {
        if(head.next==null){
            return head;
        }

        Node slow=head,fast= head;
        while(fast!=null){
            if(slow.value!=fast.value){
                slow.next=fast;
                slow=slow.next;
            }
            fast=fast.next;
        }
        slow.next=null;
        return head;
    }
}
